<%@include file="/page/taglib.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"  
    pageEncoding="UTF-8"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta name="_csrf" th:content="${_csrf.token}"/>
<meta name="_csrf_header"  th:content="${_csrf.headerName}"/>

<title>Insert title here</title>  
<style>  
.error {  
    padding: 15px;  
    margin-bottom: 20px;  
    border: 1px solid transparent;  
    border-radius: 4px;  
    color: #a94442;  
    background-color: #f2dede;  
    border-color: #ebccd1;  
}  
  
.msg {  
    padding: 15px;  
    margin-bottom: 20px;  
    border: 1px solid transparent;  
    border-radius: 4px;  
    color: #31708f;  
    background-color: #d9edf7;  
    border-color: #bce8f1;  
}  
  
#login-box {  
    width: 300px;  
    padding: 20px;  
    margin: 100px auto;  
    background: #fff;  
    -webkit-border-radius: 2px;  
    -moz-border-radius: 2px;  
    border: 1px solid #000;  
}  
</style>  
</head>  
<body onload='document.loginForm.username.focus();'>  
    <div id="login-box">  
        <h2>请输入您的用户名与密码</h2>  
        <form id="loginForm" name='loginForm' action="login" method="post">  
            <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
            <table> 
                <tr>  
                    <td>用户:</td>  
                    <td><input type='text' id="username" name='username' value=''></td>  
                </tr>  
                <tr>  
                    <td>密码:</td>  
                    <td><input type='password' id="password" name='password' /></td>  
                </tr>  
                <tr>  
                    <td colspan="2">${message }</td>  
                </tr>  
                <tr>  
                    <td colspan='2'><input id="submit" name="submit" type="submit" value="登录" /></td>  
                </tr>  
            </table>  
        </form>  
    </div>  
</body>  
<script src="${ctx }/statics/jq/jquery.min.js"></script>
<script src="${ctx }/statics/jq/jquery.validate.min.js"></script>
<script src="${ctx }/statics/jq/messages_zh.js"></script>

<script>

$(function (){
    $('#loginForm').validate({
    	rules: {
    		username: {
    			required: true,
    			minlength: 5,
    			maxlength: 25
    		},
    		password: {
    			required: true,
    			minlength: 5,
    			maxlength: 25
//     			remote: {
//     				url: '${ctx }/passCheck',
//     				type: 'post',
//     				dataType: 'json',
//     				data: {
//     					username:function() {
//     						return $('#username').val();
//     					},
//     					password:function() {
//     						return $('#password').val();
//     					},
//     					"${_csrf.parameterName}":"${_csrf.token}"
//     				}
//     			}
    		}
    	}
    })
});
</script>
</html> 
